package com.baiytfp.hf.HFDataExchange.action.controller.service;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baiytfp.hf.HFDataExchange.action.service.CallLogService;
import com.baiytfp.hf.HFDataExchange.common.model.table.CallLog;
import com.baiytfp.hf.baiytfp.common.db.HFPager;
import com.baiytfp.hf.baiytfp.framework.base.BaseController;
import com.baiytfp.hf.baiytfp.framework.base.BaseService;
import com.baiytfp.hf.baiytfp.hfutils.HFRequest;
import com.baiytfp.hf.baiytfp.hfutils.HFResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @program: HFDataExchange
 * @description: 接口日志Service
 * @author: zhenKang
 * @create: 2018-12-06 17:58
 */
@Controller
@RequestMapping("/service/calllog")
public class CallLogSController extends BaseController {
    @Autowired
    private CallLogService callLogService;

    /**
     * 接口日志列表
     * @param request
     * @param response
     * @throws Exception
     */
    @RequestMapping("callloglist")
    public void callLogList(HttpServletRequest request, HttpServletResponse response) throws Exception {
        HFPager hfPager = new HFPager(request);
        List<Map> query = callLogService.query(hfPager);
        System.out.println(query);
        HFResponse.getIstance().returnResult(response,hfPager.getResult());
    }


    @RequestMapping("test")
    public void test(HttpServletRequest request, HttpServletResponse response) throws Exception {
        String cl_id = HFRequest.getIstance().getString(request, "cl_id");
        CallLog callLog = callLogService.getById(cl_id);
        Date date = new Date();
        String s = JSON.toJSONStringWithDateFormat(date, "yyyy-MM-dd HH:mm:ss");
        System.out.println(s);

    }


}
